import Home from '../views/Home.vue'
import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
import Login from '../views/Login.vue'
import Register from '../views/Register.vue'
import Profile from '../views/Profile.vue'
import PersonalInfo from '../components/PersonalInfo.vue'
import MyOrder from '../components/MyOrder.vue'
import ShoppingCar from '../components/ShoppingCar.vue'
import MyCommodities from '../components/MyCommodities.vue'
import AddCommodity from '../components/AddCommodity.vue'
import UpdateInfo from '../components/UpdateInfo.vue'
import MyAddress from '../components/MyAddress.vue'
import SearchCommodity from '../views/SearchCommodity.vue';
import Commodity from '../views/Commodity.vue'
import ApplyStore from '../components/ApplyStore.vue'
import AdminApplyStore from '../components/AdminApplyStore.vue'
import AdminApplyCommodity from '../components/AdminApplyCommodity.vue'
import AddRecommend from '../components/AddRecommend.vue'
import Order from '../views/Order.vue'
import MyMessage from '../components/MyMessage.vue'
import FinishOrder from '../components/FinishOrder.vue'
import TransitOrder from '../components/TransitOrder.vue'
import MyStoreInfo from '../components/MyStoreInfo.vue'

const routes: Array<RouteRecordRaw> = [
    {
        path: '/',
        name: 'Home',
        component: Home
    }, {
        path: '/login',
        name: 'Login',
        component: Login
    }, {
        path: '/register',
        name: 'Register',
        component: Register
    }, {
        path: '/search',
        name: 'Search',
        component: SearchCommodity
    }, {
        path: '/commodity',
        name: 'Commodity',
        component: Commodity
    },
    {
        path: '/order',
        name: 'Order',
        component: Order
    },
    {
        path: '/profile',
        name: 'Profile',
        component: Profile,
        children: [
            {
                path: '/personalinfo',
                name: 'PersonalInfo',
                component: PersonalInfo
            }, {
                path: '/myorder',
                name: 'MyOrder',
                component: MyOrder
            }, {
                path: '/shoppingcar',
                name: 'ShoppingCar',
                component: ShoppingCar
            }, {
                path: '/mycommodities',
                name: 'MyCommodities',
                component: MyCommodities
            }, {
                path: '/addcommodity',
                name: 'AddCommodity',
                component: AddCommodity
            }, {
                path: '/updateinfo',
                name: 'UpdateInfo',
                component: UpdateInfo
            }, {
                path: '/myaddress',
                name: 'MyAddress',
                component: MyAddress
            }, {
                path: '/applystore',
                name: 'ApplyStore',
                component: ApplyStore
            }, {
                path: '/adminapplystore',
                name: 'AdminApplyStore',
                component: AdminApplyStore
            }, {
                path: '/adminapplycommodity',
                name: 'AdminApplyCommodity',
                component: AdminApplyCommodity
            }, {
                path: '/addrecommend',
                name: 'AddRecommend',
                component: AddRecommend
            }, {
                path: '/mymessage',
                name: 'MyMessage',
                component: MyMessage
            }, {
                path: '/transitorder',
                name: 'TransitOrder',
                component: TransitOrder
            }, {
                path: '/finishorder',
                name: 'FinishOrder',
                component: FinishOrder
            }, {
                path: '/myStore',
                name: 'MyStore',
                component: MyStoreInfo
            }
        ]
    }
]
const router = createRouter({
    history: createWebHashHistory(process.env.BASE_URL),
    routes
})

export default router;
